package array;
/**
 * 数组常见问题:索引越界异常
 */
public class arraydemo8 {
    public static void main(String[] args) {
        int[] arr = new int[3];
        System.out.println(arr[0]);
        System.out.println(arr[1]);
        System.out.println(arr[2]);
        //System.out.println(arr[3]); //ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
        //本质上就是取超过最大索引的元素,根本不存在
        //System.out.println(arr[-2]);//不存在负数索引
    }
}
